package com.tduck.cloud.api.web.ao;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tduck.cloud.form.entity.FormUserRelationEntity;
import com.tduck.cloud.form.service.FormUserRelationService;
import com.tduck.cloud.form.vo.FormUserRelationVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 表单用户关系ao
 *
 * @author Guard Baby
 * @date 2023/09/09
 */
@Service("formUserRelationAO")
@Slf4j
@RequiredArgsConstructor
public class FormUserRelationAO {
    private final FormUserRelationService formUserRelationService;

    @Transactional(rollbackFor = Exception.class)
    public boolean save(FormUserRelationVo vo){
        String formKey = vo.getFormKey();
        FormUserRelationEntity formUserRelationEntity = new FormUserRelationEntity();
        BeanUtil.copyProperties(vo, formUserRelationEntity,true);
        return formUserRelationService.saveOrUpdate(formUserRelationEntity);
    }

}
